table of contents
CREATE FOREIGN DATA WRAPPER(7) | PostgreSQL 9.2.24 Documentation | CREATE FOREIGN DATA WRAPPER(7) |
NAME¶
CREATE_FOREIGN_DATA_WRAPPER - define a new foreign-data wrapper
SYNOPSIS¶
CREATE FOREIGN DATA WRAPPER name
[ HANDLER handler_function | NO HANDLER ]
[ VALIDATOR validator_function | NO VALIDATOR ]
[ OPTIONS ( option 'value' [, ... ] ) ]
DESCRIPTION¶
CREATE FOREIGN DATA WRAPPER creates a new foreign-data wrapper. The user who defines a foreign-data wrapper becomes its owner.
The foreign-data wrapper name must be unique within the database.
Only superusers can create foreign-data wrappers.
PARAMETERS¶
name
HANDLER handler_function
It is possible to create a foreign-data wrapper with no handler function, but foreign tables using such a wrapper can only be declared, not accessed.
VALIDATOR validator_function
OPTIONS ( option 'value' [, ... ] )
NOTES¶
At the moment, the foreign-data wrapper functionality is rudimentary. There is no support for updating a foreign table, and optimization of queries is primitive (and mostly left to the wrapper, too).
There is one built-in foreign-data wrapper validator function provided: postgresql_fdw_validator, which accepts options corresponding to libpq connection parameters.
EXAMPLES¶
Create a useless foreign-data wrapper dummy:
CREATE FOREIGN DATA WRAPPER dummy;
Create a foreign-data wrapper file with handler function file_fdw_handler:
CREATE FOREIGN DATA WRAPPER file HANDLER file_fdw_handler;
Create a foreign-data wrapper mywrapper with some options:
CREATE FOREIGN DATA WRAPPER mywrapper
OPTIONS (debug 'true');
COMPATIBILITY¶
CREATE FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), with the exception that the HANDLER and VALIDATOR clauses are extensions and the standard clauses LIBRARY and LANGUAGE are not implemented in PostgreSQL.
Note, however, that the SQL/MED functionality as a whole is not yet conforming.
SEE ALSO¶
ALTER FOREIGN DATA WRAPPER (ALTER_FOREIGN_DATA_WRAPPER(7)), DROP FOREIGN DATA WRAPPER (DROP_FOREIGN_DATA_WRAPPER(7)), CREATE SERVER (CREATE_SERVER(7)), CREATE USER MAPPING (CREATE_USER_MAPPING(7))
2017-11-06 | PostgreSQL 9.2.24 |